package com.xinzhi.controller;

import com.xinzhi.entity.ProductType;
import com.xinzhi.entity.Result;
import com.xinzhi.service.ProductService;
import com.xinzhi.service.ProductTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/productType")
public class ProductTypeController {

    @Autowired
    private ProductService productService;
    @Autowired
    private ProductTypeService productTypeService;


    @RequestMapping("/all")
    @ResponseBody
    public List<ProductType> getProductType(){
        return productService.getAllProductType();
    }


    @RequestMapping("/getType")
    @ResponseBody
    public Result getProductByType(String productTypeId){
        return productTypeService.getProductTypeByTypeId(productTypeId);
    }



}
